Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

6.7K
Visualizações
Flask App Error while deploying to Heroku at=error code=H10 desc="App crashed" method=GET path="/"

The sample flask app is giving error at=error code=H10 desc="App crashed" method=GET path="/" while deploying in Heroku.

Flaskapp.py

from flask import Flask

app = Flask(__name__)


@app.route('/')
def index():
    return "<h1> Deployed to Heroku</h1>"


if __name__ == "__main__":
    app.run()'''

Pocfile

web : gunicorn flaskapp:app

requirements.txt

Click==7.0
Flask==1.1.1
gunicorn==20.0.4
itsdangerous==1.1.0
Jinja2==2.10.3
MarkupSafe==1.1.1
Werkzeug==0.16.0

error log below

2020-01-10T10:35:14.658092+00:00 heroku[web.1]: Starting process with command `: gunicorn flaskapp:app`
2020-01-10T10:35:16.404755+00:00 heroku[web.1]: State changed from starting to crashed
2020-01-10T10:35:16.381754+00:00 heroku[web.1]: Process exited with status 0
2020-01-10T10:35:19.000000+00:00 app[api]: Build succeeded
2020-01-10T10:35:38.654704+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=flaskapp-te.herokuapp.com request_id=6712472d-a734-4720-b152-1e2716844c41 fwd="137.97.4.98" dyno= connect= service= status=503 bytes= protocol=https
2020-01-10T10:35:39.689766+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=flaskapp-te.herokuapp.com request_id=89a26803-5b09-4a94-99a2-5b0d154d7797 fwd="137.97.4.98" dyno= connect= service= status=503 bytes= protocol=https

followed some blogs and couldnt solve. Please assist

over 4 years ago · Santiago Trujillo
7 Respostas
Responde à pergunta

0

Modified the Procfile as mentioned in the below post to

web: gunicorn --bind 0.0.0.0:$PORT flaskapp:app
over 4 years ago · Santiago Trujillo Relatório

0

In proc file web: gunicorn --bind 0.0.0.0:$PORT app:app Confirm in app if name == 'main': app.run(debug=True)

over 4 years ago · Santiago Trujillo Relatório

0

Make sure gunicorn is included in the requirements.txt file.

over 4 years ago · Santiago Trujillo Relatório

0

I got the same error, compared to the last time you might have installed some new packages in pip and imported them in your app.py file. Just regenerate your requirements.txt file and again push it to heroku master, it will run fine

1> Open your terminal

2> type - cd YOUR_PROJECT_DIRECTORY

3> type - pip freeze > requirements.txt

4> push your code to the your repository.

5> git push heroku master

over 4 years ago · Santiago Trujillo Relatório

0

My Project Structure

My Project Structure Create file named Procfile (extension not required) - write a following line into it web: gunicorn main:app where "main" is the file name in which app = create_app() is mentioned

pip install gunicorn

pip freeze > requirements.txt

create one more file named runtime.txt which contains following line python-3.9.2 (provide respective python version of your project)

Heroku Part: run following commands one by one using gitbash or vscode console

heroku login

git init

git add .

git commit -am "Initial Commit"

git push heroku main

over 4 years ago · Santiago Trujillo Relatório

0

You have the bug in your procfile.

web: gunicorn

It should be written like this. Don't give a space after web and it will work fine.

over 4 years ago · Santiago Trujillo Relatório

0

1 year and 2 months later. As the other answers pointed out, there is a an issue in the Procfile. I personally don't think the --bind 0.0.0.0:$PORT is needed as my apps have run fine with out that portion of code - but I don't pretend to know what its purpose is. For this particular issue, the space in the Procfile is the issue and I found this tutorial helpful when addressing my own Procfile issues.

However, I wanted to add the following for those finding this while knowing their Procfile isn't the issue but are still getting the h10 error.

For those finding this specifically for h10 error, and you know your Procfile is correct, make sure you are reading the full logs. I found that hidden in the mess were lines stating that certain modules were not found. Apparently my pip installs were incomplete or not in my virtual env folder. And not all missing installations will show up. Each push may present new modules that need to be installed and added to your requirements.txt file. Took several pushes to work through each missing item and eventually my app began to run correctly on Heroku.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda